package com.manage.project.biz.controller;

import java.util.List;

import com.manage.common.utils.poi.ExcelUtil;
import com.manage.framework.aspectj.lang.annotation.Log;
import com.manage.framework.aspectj.lang.enums.BusinessType;
import com.manage.framework.web.controller.BaseController;
import com.manage.framework.web.domain.AjaxResult;
import com.manage.framework.web.page.TableDataInfo;
import com.manage.project.biz.domain.BizJiankongyutongxin;
import com.manage.project.biz.service.IBizJiankongyutongxinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Controller
 *
 * @author
 * @date 2022-06-01
 */
@RestController
@RequestMapping("/biz/jiankongyutongxin")
public class BizJiankongyutongxinController extends BaseController
{
    @Autowired
    private IBizJiankongyutongxinService bizJiankongyutongxinService;

    /**
     * 查询列表
     */
//    @PreAuthorize("@ss.hasPermi('biz:jiankongyutongxin:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizJiankongyutongxin bizJiankongyutongxin)
    {
        startPage();
        List<BizJiankongyutongxin> list = bizJiankongyutongxinService.selectBizJiankongyutongxinList(bizJiankongyutongxin);
        return getDataTable(list);
    }

    /**
     * 导出列表
     */
//    @PreAuthorize("@ss.hasPermi('biz:jiankongyutongxin:export')")
//    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, BizJiankongyutongxin bizJiankongyutongxin) throws IOException {
//        List<BizJiankongyutongxin> list = bizJiankongyutongxinService.selectBizJiankongyutongxinList(bizJiankongyutongxin);
//        ExcelUtil<BizJiankongyutongxin> util = new ExcelUtil<BizJiankongyutongxin>(BizJiankongyutongxin.class);
//        util.exportExcel(response, list, "【请填写功能名称】数据");
//    }
    @Log(title = "监控与通信", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BizJiankongyutongxin bizJiankongyutongxin)  {
        List<BizJiankongyutongxin> list = bizJiankongyutongxinService.selectBizJiankongyutongxinList(bizJiankongyutongxin);
        ExcelUtil<BizJiankongyutongxin> util = new ExcelUtil<BizJiankongyutongxin>(BizJiankongyutongxin.class);
        return util.exportExcel(list, "监控与通信数据");
    }

    /**
     * 获取详细信息
     */
//    @PreAuthorize("@ss.hasPermi('biz:jiankongyutongxin:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(bizJiankongyutongxinService.selectBizJiankongyutongxinById(id));
    }

    /**
     * 新增
     */
//    @PreAuthorize("@ss.hasPermi('biz:jiankongyutongxin:add')")
    @Log(title = "新增", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizJiankongyutongxin bizJiankongyutongxin)
    {
        return toAjax(bizJiankongyutongxinService.insertBizJiankongyutongxin(bizJiankongyutongxin));
    }

    /**
     * 修改
     */
//    @PreAuthorize("@ss.hasPermi('biz:jiankongyutongxin:edit')")
    @Log(title = "修改", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizJiankongyutongxin bizJiankongyutongxin)
    {
        return toAjax(bizJiankongyutongxinService.updateBizJiankongyutongxin(bizJiankongyutongxin));
    }

    /**
     * 删除
     */
//    @PreAuthorize("@ss.hasPermi('biz:jiankongyutongxin:remove')")
    @Log(title = "删除", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bizJiankongyutongxinService.deleteBizJiankongyutongxinByIds(ids));
    }
}
